package com.caac.core.web.action.user;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.caac.core.dm.NormalUser;
import com.caac.core.service.UserManager;
import com.caac.core.web.action.BaseAction;
import com.caac.core.web.form.BaseForm;
import com.caac.core.web.form.UserForm;

import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

/**
 * <p>Title: </p>
 * <p>Description: </p>
 * <p>Copyright: Copyright AgileCentury 2005</p>
 * <p>Company: AgileCentury</p>
 * @author <a href="mailto:project@agilecentury.com">Project Group</a>
 * @version 1.0
 */

public class PassUserAction extends BaseAction {

    protected ActionForward doExecute(ActionMapping mapping,
                                      BaseForm form,
                                      HttpServletRequest request,
                                      HttpServletResponse response) throws
            Exception {
        UserForm uf = (UserForm) form;
        String id = request.getParameter("id");
        String state = request.getParameter("state");
        UserManager manager = this.getUserManager();
        NormalUser user = (NormalUser) manager.getUserById(id);
        uf.setUser(user);
        return this.forward(mapping, "success" + state);
    }
}
